﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Maticsoft.DBUtility;//请先添加引用

namespace BaoJian.e.control
{
    public partial class CommonRec : System.Web.UI.UserControl
    {
        public string ColumnID = null;
        public string ColTitle = "";
        private string sql = "SELECT A.PID,A.[Name],B.[Description],A.[ImagePath]  FROM [EProduct] AS A ,[EColumn] AS B WHERE A.[PID] = B.[PID] AND [EColumnID]='{0}' ORDER BY B.[SID] desc";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                sql = string.Format(sql, ColumnID);
                SqlDataReader rd = DbHelperSQL.ExecuteReader(sql);

                LYQ.BLL.SysObj bll = new LYQ.BLL.SysObj();
                ColTitle = bll.GetModel(ColumnID).OName;
                //Image
                if (rd.Read())
                {
                    Image1.ImageUrl = rd["ImagePath"] as string;

                    HyperLink1.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                    HyperLink1.ToolTip = rd["Name"] as string;

                    HyperLink2.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                    HyperLink2.ToolTip = rd["Name"] as string;
                    HyperLink2.Text = rd["Name"] as string;
                }
                if (rd.Read())
                {
                    Image2.ImageUrl = rd["ImagePath"] as string;

                    HyperLink3.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                    HyperLink3.ToolTip = rd["Name"] as string;

                    HyperLink4.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                    HyperLink4.ToolTip = rd["Name"] as string;
                    HyperLink4.Text = rd["Name"] as string;
                }

                if (rd.Read())
                {
                    Image3.ImageUrl = rd["ImagePath"] as string;
                    HyperLink5.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                    HyperLink5.ToolTip = rd["Name"] as string;

                    HyperLink6.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                    HyperLink6.ToolTip = rd["Name"] as string;
                    HyperLink6.Text = rd["Name"] as string;

                    //Title
                    if (rd.Read())
                    {
                        HyperLink7.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                        HyperLink7.Text = rd["Name"] as string;
                    }

                    if (rd.Read())
                    {
                        HyperLink8.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                        HyperLink8.Text = rd["Name"] as string;
                    }
                    if (rd.Read())
                    {
                        HyperLink9.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                        HyperLink9.Text = rd["Name"] as string;
                    }
                    if (rd.Read())
                    {
                        HyperLink10.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                        HyperLink10.Text = rd["Name"] as string;
                    }
                    if (rd.Read())
                    {
                        HyperLink11.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                        HyperLink11.Text = rd["Name"] as string;
                    }
                    if (rd.Read())
                    {
                        HyperLink12.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                        HyperLink12.Text = rd["Name"] as string;
                    }
                    if (rd.Read())
                    {
                        HyperLink13.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                        HyperLink13.Text = rd["Name"] as string;
                    }
                    if (rd.Read())
                    {
                        HyperLink14.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                        HyperLink14.Text = rd["Name"] as string;
                    }
                    if (rd.Read())
                    {
                        HyperLink15.NavigateUrl = "../detail.aspx?pid=" + rd["PID"] as string + "&TID=1";
                        HyperLink15.Text = rd["Name"] as string;
                    }
                }
            }

        }
    }
}